import {
  Entity,
  Column,
  PrimaryGeneratedColumn,
  ManyToOne,
  JoinColumn,
} from "typeorm";
import { UserModel } from "./User.model";

@Entity("todo")
export class TodoModel {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  text: string;

  @Column({ default: false })
  done: boolean;

  @Column({ type: "int", name: "user_id" })
  userId: number;

  @ManyToOne(() => UserModel)
  @JoinColumn({ name: "user_id" })
  user: UserModel;
}
